package com.whisper.hfdp.mq.producer;

import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.common.message.Message;

import java.nio.charset.StandardCharsets;

public class OnewayProducer {
    public static void main(String[] args) throws Exception {
        DefaultMQProducer producer = new DefaultMQProducer("whisper");
        producer.setNamesrvAddr("localhost:9876");
        producer.start();

        int msgCount = 100;
        for (int i = 0 ; i < msgCount; i++ ) {
            Message message = new Message("TopicTest", "TagA", ("Hello " + i).getBytes(StandardCharsets.UTF_8));
            producer.sendOneway(message);
        }
        producer.shutdown();
    }
}
